#include <iostream>

using namespace std;

bool check(int n) {
    int state = 1;
    while (n) {
        int r = n % 10;
        if (r % 2 != state) return false;
        n /= 10;
        state = !state;
    }
    return true;
}

int main() {
    int n, ans = 0;
    cin >> n;
    for (int i = 1; i <= n; i++) {
        ans += check(i);
    }
    cout << ans << endl;
}